﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ThucThe;
using DieuKhien;

namespace GiaoDien
{
    public partial class QL_KhachSan : Form
    {
        public QL_KhachSan()
        {
            InitializeComponent();
        }
        KhachSan_dieukhien ks_dk = new KhachSan_dieukhien();
        KhachSan_thucthe ks_tt = new KhachSan_thucthe();
      
        private void btn_OK_Click(object sender, EventArgs e)
        {
            try
            {
                ks_tt.TenKhachSan = txt_tenKS.Text.Trim();
                ks_tt.Sdt = msktxt_sdt.Text.Trim();
                ks_tt.Email = txt_email.Text.Trim();
                ks_tt.DiaChi = txt_diaChiKS.Text.Trim();
                ks_tt.MoTa = txt_moTa.Text.Trim();

                ks_dk.Them_KhachSan(ks_tt);
                MessageBox.Show("Thêm thành công", "");
                this.Close();
                //QL frm_ql = new QL();
                //frm_ql.Show();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Nhập đầy đủ các trường", "");
            }
            catch (FormatException)
            {
                MessageBox.Show("Nhập số cho số điện thoại");
            }
        }

        private void btn_exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_reset_Click(object sender, EventArgs e)
        {
            txt_tenKS.Text = "";
            msktxt_sdt.Text = "";
            txt_email.Text = "";
            txt_diaChiKS.Text = "";
            txt_moTa.Text = "";
        }
    }
}
